<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>v-on 实例</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
<h1>v-on 实例</h1>
<hr>
<div id="app">
    得分:{{score}}
    <p>
        <button v-on:click="plus">加分</button>
        <button @click="sub">减分</button>
        <br>
        <input type="text" v-model="incr" @keyup.enter="enterKey">
    </p>
</div>
<script type="text/javascript">
    var app = new Vue({
      el:'#app',
      data:{
        score:0,
        incr:1
      },
      methods:{
        plus(){
          return this.score++
        },
        sub(){
          return this.score--
        },
        enterKey(){
          return this.score= this.score + Number(this.incr)
        }
      }
    })
</script>
</body>
</html>